int isRunned(BOOK * book)
{
  if(!strcmp(book->xbook->name,"AdvPlayer")) 
    return 1;
  return 0;
}

GUI *FindGuiInBook(BOOK *bk, char *name)
{
  LIST *lst=bk->xguilist->guilist;
  for (int x=0;x<lst->FirstFree;x++)
  {
    GUI * g=(GUI*)List_Get(lst,x);
    if (strcmp(DispObject_GetName(GUIObject_GetDispObject(g)),name)==0)
      return g;
  }
  return 0;
};

int minimizeAndSet (wchar_t*spath, wchar_t* skinname)
{
  BookObj_Hide(FindBook(isRunned),0);
  GUIObject_Destroy(MMSBook->board);
  REQUEST_IMAGEHANDLER_INTERNAL_UNREGISTER(SYNC,image[0].ImageHandle,0,0,image[0].ImageID,1,&error_code);
  RegisterImage(&image[0] ,spath,skinname);
  GC_FreeGC( m_hMGC );
  gcmem_xsize=GetImageWidth( image[0].ImageID );
  m_smilgc= NULL;
  return 0;
}

u16 RegisterImage(IMG * i , wchar_t * path, wchar_t * fname)
{
         char error_code;
         i->ImageID=0xFFFF;
         i->ImageHandle=0xFFFF;
         if (!fstat(path,fname,0))
         {
                 if (!REQUEST_IMAGEHANDLER_INTERNAL_GETHANDLE(SYNC,&i->ImageHandle,&error_code))
                 {
                         if (!REQUEST_IMAGEHANDLER_INTERNAL_REGISTER(SYNC,i->ImageHandle,path,fname,0,&i->ImageID,&error_code))
                         {
                                 if (error_code)
                                 {
                                         i->ImageHandle=0xFFFF;
                                 }
                         }
                 }
         }
         return(i->ImageID);
};

void RunGUI (BOOK*b,GUI*)
{
      CreateBoardGui(MMSBook);
      GUIObject_Show(MMSBook->board);
      BookObj_SetFocus(FindBook(isRunned),0);
}
